package com.zzyy.study.aspect;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Slf4j
@Component
public class DemoAspect2 {
    @Pointcut("(@target(org.springframework.web.bind.annotation.RestController))"+
    "&&within(com.zzyy.study..*)&& execution(public **(..))")

    public void pointcut() {}

    @Around(value = "pointcut()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint)throws Throwable {
        log.info("Aop 进入");
        //主业务逻辑，放行
        Object proceed = proceedingJoinPoint.proceed();
        log.info("Aop 退出");
        return proceed;
    }


}
